package com.pioneer.gui.invoice.view;

import com.pioneer.gui.invoice.model.InvoiceModel;
import com.pioneer.gui.invoice.model.DropDownList;
import com.pioneer.gui.invoice.view.NavigationPanel;
import com.pioneer.gui.invoice.util.Constants;

import java.awt.FlowLayout;
import java.awt.GridLayout;


import java.awt.BorderLayout;
import javax.swing.BorderFactory;

import java.util.Iterator;
import java.util.HashMap;
import java.util.Vector;

import javax.swing.BoxLayout;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JTextArea;
import javax.swing.JComboBox;


public class InvoicePanel
extends JPanel
implements Constants
{
	public CustomerPanel customerPanel;
	public InvoiceNoPanel invoiceNoPanel;
	public AddressPanel addressPanel;
	public DetailsPanel detailsSection;
	public FooterPanel footerPanel;
	public JTextArea invoiceTerms;

	public InvoicePanel(InvoiceModel model)
	{		
		this.setBorder(BorderFactory.createEmptyBorder(
                                        15, //top
                                        15, //left
                                        5, //bottom
                                        15) //right
                                        );
        this.setLayout(new BorderLayout());
		
		// This is the header section
		
		JPanel headerSection=new JPanel();		
		headerSection.setLayout(new BoxLayout(headerSection,BoxLayout.Y_AXIS));
		
		// Define the invoice primary information panel

		JPanel identifierPanel=new JPanel(new BorderLayout());
		
		// Define the customer panel
		
		customerPanel=new CustomerPanel(model);
		identifierPanel.add(customerPanel,BorderLayout.WEST);
		
		// Define the invoice primary information panel
				
		invoiceNoPanel=new InvoiceNoPanel(model);
		identifierPanel.add(invoiceNoPanel,BorderLayout.CENTER);		
		headerSection.add(identifierPanel);
		
		// Define the address panel
		
		addressPanel=new AddressPanel(model);		
		headerSection.add(addressPanel);		
		this.add(headerSection,BorderLayout.NORTH);
		
		// End header section
		
		detailsSection=new DetailsPanel(model);
		//model.addChangeListener(new InvoiceModeltoDetailsPanelAdapter(model,detailsSection));
		
		this.add(detailsSection,BorderLayout.CENTER);
		
		//pane.add(new DetailsPanel(invoiceModel),BorderLayout.CENTER);
		
		// This is the footer Section
		footerPanel=new FooterPanel(model,detailsSection);
		this.add(footerPanel,BorderLayout.SOUTH);
		
		// End footer section
	}
}